function soso(){
	var content = document.getElementById('content').value;
	alert('搜索的内容是：'+content)
}
function showTime(){
	var date = new Date();
	var y = date.getFullYear()
	var m = date.getMonth()+1;//第一个月为0
	var d = date.getDate()
	var h = date.getHours()
	var min = date.getMinutes()
	var s = date.getSeconds()
	var time = y+"-"+m+"-"+d+"-"+h+":"+min+":"+s
	document.getElementById('time').innerHTML = time;
}

window.onload = function(){
	showTime()
	//定时函数
	setInterval(showTime,2000);
	t = window.setInterval(showTime,4000);
	var numLis = document.getElementById("nums").getElementsByTagName("li");
	for(var i=0;i<numLis.length;i++){
		numLis[i].onclick = function(){
			//console.log(this) this就是整个元素节点
			//获取节点的内容
			//console.log(this.innerHTML)
			window.clearInterval(t);
			//清除定时器
			t=null;
			index = parseInt(this.innerHTML) -1;
			showImg();
			t=window.setInterval(showImg,4000);
		}
	}
}


//图片显示和隐藏
var index = 0
function showImg(){
	var adLis = document.getElementById("ads").getElementsByTagName("li");
	var numLis = document.getElementById("nums").getElementsByTagName("li");
	
	for(var i=0;i<adLis.length;i++){
		if(i==index){
			adLis[i].style.display="block";
			numLis[i].style.backgroundColor="red"
		}
		else{
			adLis[i].style.display="none";
			numLis[i].style.backgroundColor="seagreen"
		}
	}
	
	
	index++;
	if(index>=adLis.length){
		index = 0;
	}
}